#!/bin/bash
OK=0
WARN=1
CRITICAL=2
UNKNOWN=3
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
check_item="Afs fileserver"
OK_name=''
Fail_name=''
Judge=0

res=`cat /var/log/messages|grep "Saved core dump"|grep "/usr/afs/bin/fileserver"`
echo $res>>/tmp/monitor_fileserver.log

if [ -z "$res" ]
then
	echo "Afs fileserver is OK"
	exit $OK
else
	resstatus=`bos status $(hostname -s)|grep "Auxiliary status is: file server running" 2>/dev/null`
	if [ -z "$resstatus" ]
	then
		echo "Afs fileserver is wrong"
		exit $CRITICAL
	else
        	echo "Afs fileserver is OK"
        	exit $OK
	fi
fi

